class @AdminAuthorListingModel extends ListingModel
    @ListingUrl:''
    initialize: ->
        if AdminAuthorListingModel.ListingUrl.length is 0
            AdminAuthorListingModel.ListingUrl = SiteMap.Admin.Authors.Listing
    
    defaults:
        Size: 10
        Page: 1
        Direction: 0
        Authors: []
        Column: "FirstName"
        Filter:
            FirstName: ''
            LastName: ''

    url: ->
        url = AdminAuthorListingModel.ListingUrl
        url += "?page=" + @attributes.Page
        url += "&size=" + @attributes.Size
        url += "&Column=" + @attributes.Column
        url += "&Direction=" + @attributes.Direction
        url += "&Filter.FirstName=" + @attributes.Filter.FirstName
        url += "&Filter.LastName=" + @attributes.Filter.LastName
        SiteMap.Admin.Authors.Listing = encodeURI(url)
        return SiteMap.Admin.Authors.Listing

    parse: (response) ->
        attrs = {
            Size: response.Size
            Page: response.Page
            TotalPages: response.TotalPages
            Column: response.Column
            Direction: response.Direction
            Filter: @attributes.Filter
        }

        attrs.Authors = response.Authors
        if response.Filter.FirstName?
            attrs.Filter.FirstName = response.Filter.FirstName
        if response.Filter.LastName?
            attrs.Filter.LastName = response.Filter.LastName

        return attrs